﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CHSN;
using Jaunt_Card;

namespace AllTest
{
    class Program
    {
        static void Main(string[] args)
        {

            /*CHSNer cHSNer = new CHSNer();

            byte[] bID = cHSNer.GetPhysicalSerialNumber();

            foreach(byte b in bID)
            {
                Console.Write(b.ToString("X2") + " ");
            }*/

            //卡密码计算
            uint cardSerialNum = 556879121;
            uint currCardPassword = 123456;

            //根据卡序列号与当前卡密码计算得出要写入卡中的密码
            uint writePassword = (uint)Card.CalcCardPassword(cardSerialNum, currCardPassword);

            Console.WriteLine("CRC1=" + writePassword.ToString("X8"));


            //校验接口调用
            byte[] card_buf = { 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00,
                                0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
                                0x00, 0x00 };

            card_buf[14] = Card.FM1701_CRC1(card_buf, 14);
            card_buf[15] = Card.FM1701_CRC2(card_buf, 15);

            Console.WriteLine("CRC1=" + card_buf[14].ToString("X2"));
            Console.WriteLine("CRC2=" + card_buf[15].ToString("X2"));


            Console.ReadKey();
        }
    }
}
